<%@ Page language="vb" CodeFile="userInside.aspx.vb" Inherits="userInside_aspx_vb" %>

<%
    If CDbl(mobileGUI) = 1 Then 
        Response.Redirect("userInsideMobileGUI.aspx")
    Else
        dbOpen()
        RecSet = Conn.Execute("Select username From tblUser Where userID = " & fragusLeasingUserID & "")
        If RecSet.EOF Then 
            Response.Redirect("logOut.aspx")
        Else
            username = RecSet.Fields("username").Value
        End IF
        RecSet.Close()
        RecSet = Nothing
        dbClose()
        '*************** The function OVER gives the logo and the menu bar *************************
        Over()
        '*************** The welcome plus the name of the user *******************
        Response.Write("<table cellpadding='0' cellspacing='0' border='0' width='1000'>")
        Response.Write("<tr>")
        Response.Write("<td valign='top'>")
        Response.Write("<table cellpadding='2' cellspacing='2' width='450'>")
        Response.Write("<tr><td class='headline'>WELCOME " & UCase(username) & " TO FLS<hr class='hrHeadline'></td></tr>")
        Response.Write("</table>")
        Response.Write("</td>")
        '*************** The names of the countries ( the right table ) **********
        Response.Write("<td width='100'></td>")
        Response.Write("<td valign='top'>")
        Response.Write("<table cellpadding='2' cellspacing='2' width='450'>")
        Response.Write("<tr><td class='headline' colspan='2'>NUMBER OF ACTIVE LEASE CONTRACTS - STATISTICS<hr class='hrHeadline'></td></tr>")
        '********** the Function open gives the db connection *************************
        dbOpen()
        '************* The REcord set gives the info for the right table **************
        RecSet = Conn.Execute("Select c.country, (Select Count(v.vehicleID) From tblVehicle v Where v.countryID = c.countryID And active = 1 And completed = 0) As vehicleCount From tblCountry c Order By c.country")
        If Not RecSet.EOF Then 
            Do Until RecSet.EOF
                country = RecSet.Fields("country").Value
                vehicleCount = RecSet.Fields("vehicleCount").Value
                Response.Write("<tr><td class='formBold'>" & country & ":</td><td align='right'>" & vehicleCount & " st</td></tr>")
                RecSet.MoveNext()
            Loop
        End IF
        RecSet.Close()
        RecSet = Nothing
        '*********** The function Close, closes the db connection **********************
        dbClose()
        Response.Write("<tr><td colspan='2'><hr class='hrHeadline'></td></tr>")
       
        Response.Write("</table>")
        Response.Write("</td>")
        Response.Write("</tr>")
        Response.Write("</table>")
        '************ The dunction under rep+resents the close div, table and html ******
        Under()
    End IF
%>
